home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3765 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.1 KB  |  75 lines

  1. Path: lugb.latrobe.edu.au!luxor!ccmrc
  2. From: ccmrc@luxor.latrobe.edu.au (Marcus Crafter)
  3. Newsgroups: comp.lang.c
  4. Subject: Help with Curses!
  5. Date: 31 Jan 1996 00:23:04 GMT
  6. Organization: La Trobe University
  7. Message-ID: <4emcp8$3i5@lugb.latrobe.edu.au>
  8. NNTP-Posting-Host: luxor.latrobe.edu.au
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.  
  12. Hi There !
  13.  
  14.     I am working on writing a curses application at the moment,
  15.     but I can't seem to set the background of a curses based window
  16.     regardless of what I try. Here is the code that won't work as an
  17.     application itself, all I want it to do is clear the stdscr 
  18.     window to a blue background.
  19.     Please! If someone can see what I am doing wrong, could they let
  20.     me know!
  21.         
  22.                         Thanks for your help
  23.  
  24.                         Marcus
  25.  
  26. -------------------------------------------------------------------------
  27. #include <ncurses.h>
  28. #include <stdlib.h>
  29.  
  30. chtype attr;
  31.  
  32. main()
  33. {
  34.   initscr();     /* Init curses */
  35.   keypad(stdscr, TRUE);
  36.   cbreak();
  37.   noecho();
  38.  
  39.   start_color();
  40.  
  41.   init_pair(1,COLOR_WHITE,COLOR_BLUE);
  42.   attr = (0|COLOR_PAIR(1));
  43.  
  44.   wattrset(stdscr,attr);
  45.   werase(stdscr);
  46.  
  47.   printw("Colors = %d Colour Pairs = %d\n",COLORS,COLOR_PAIRS);
  48.  
  49.   wnoutrefresh(stdscr);
  50.  
  51.   refresh();
  52.   sleep(1);
  53.   endwin();
  54. }
  55. -------------------------------------------------------------------------
  56.  
  57. --
  58.           .....            .....
  59.        ,,$$$$$$$$$,      ,$$$$$$$$$$,
  60.       ;$'      '$$$$:   ;$'      '$$$$:
  61.       $:         $$$$:  $:         $$$$:     Marcus Crafter 
  62.        $       o_)$$$:   $      o_) $$$:  Computer Systems Engineering
  63.        ;$,    _/\ &&:'   ;$,   _/\  &&:' La Trobe University, Melbourne
  64.          '     /( &&&      '    /(  &&&           Australia
  65.              \_&&&&'         \_&&&&'
  66.             &&&&.           &&&&.      e-Mail : m.crafter@latrobe.edu.au
  67.       &&&&&&&:       &&&&&&&&:               Phone  : 03 479 1895 
  68.         http://www.studyhall.latrobe.edu.au/crafterm/ 
  69.  
  70.   Pentium 120 PCI - 16 Meg EDO RAM - 1.6 GIG Seagate Medalist HDD - Sampo 17"
  71.           Diamond Stealth 64 Video VRAM 2MEG - Quad Speed NEC CDROM !!
  72.           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73.                         LINUX - Windows 95
  74.                 ~~~~~~~~~~~~~~~~~~
  75.